import math

from shapely import geometry

def trans_entity2geom(entity):
    # geometry
    pass


def disjoint_with_others(geom, others):
    for other in others:
        if other is geom: continue
        if not geom.disjoint(other):
            return False
    return True


def agent_collision(self, agent):
    for other in self.agents:
        if other is agent: continue
        if other.size + agent.size >= self.distance(agent.state.p_pos, other.state.p_pos):
            return True
    return False


def distance(pt1, pt2):
    return math.sqrt(math.pow(pt1[0] - pt2[0], 2) + math.pow(pt1[1] - pt2[1], 2))
